package com.chiyoyo.rabbitmq.framework.dto;

import lombok.Getter;
import lombok.Setter;
import org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer;
import org.springframework.util.ObjectUtils;

/**
 * @author chil
 */
@Setter
@Getter
public class MessageQueueDetail {

    /**
     * 队列名称
     */
    private String queueName;

    /**
     * 监听容器标识
     */
    private String containerIdentity;

    /**
     * 监听是否有效
     */
    private boolean activeContainer;

    /**
     * 是否正在监听
     */
    private boolean running;

    /**
     * 活动消费者数量
     * 消息队列详情类构造函数
     *
     * @param queueName 队列名称
     * @param container 消息监听容器
     */
//	private int activeConsumerCount;
    public MessageQueueDetail(String queueName, AbstractMessageListenerContainer container) {
        this.queueName = queueName;
        this.running = container.isRunning();
        this.activeContainer = container.isActive();
//		this.activeConsumerCount = container.;
        this.containerIdentity = "Container@" + ObjectUtils.getIdentityHexString(container);
    }
}
